package top.heliming.youyou.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

/**
 * description: //TODO
 *
 * @author: heliming
 * @date:2019/06/08 下午 12:16
 */
@Table(name = "tb_user")
@Data
public class User {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;
  @Length(min = 4, max = 30, message = "用户名只能在4~30位之间")
  private String username;// 用户名

  @JsonIgnore
  @Length(min = 4, max = 30, message = "用户名只能在4~30位之间")
  private String password;// 密码

  @Pattern(regexp = "^1\\d{10}$", message = "手机号格式不正确")
  private String phone;// 电话

  private Date created;// 创建时间

  @JsonIgnore
  private String salt;// 密码的盐值
}
